﻿@model Apps.Models.SELF_SAMPLING_RC_RELATED
@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Locale;
@using Apps.Models.Sys;
@using Apps.Models;
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
}
<script type="text/javascript">
    $(function () {

        function updateAvatar() {
            let formData = new FormData($('#userAvatarForm')[0]);
            formData.append("avatar", $("#img")[0].files[0]);
            formData.append("TEST_CODE", $("#testCode").val());
            formData.append("ITEM_NAME", $("#ITEM_NAME").val());
            formData.append("ITEM_VALUE", $("#ITEM_VALUE").val());
            formData.append("YAN_ID", $("#YAN_ID").val());

            let uploading = false;
            if (uploading) {
                alert("文件正在上传中，请稍候!");
                return false;
            }

            $.ajax({
                url:  "@Url.Action("Edit")",
                type: 'POST',
                data: formData,
                contentType: false,
                processData: false,
                dataType: "json",
                beforeSend: function () {
                    uploading = true;
                    console.log(uploading);
                },
                success: function (data) {
                    uploading = false;
                    if (data.type == 1) {
                        window.parent.frameReturnByMes(data.message);
                        window.parent.frameReturnByReload(true);
                        window.parent.frameReturnByClose()
                    }
                    else {
                        window.parent.frameReturnByMes(data.message);
                    }
                }
            })
        }


        $("#btnSave").click(function () {
            updateAvatar();
        });
        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose();
        });
    });
</script>

<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "fa fa-save", Resource.Save, "Save", false)
    @Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply, false)
</div>
@using (Html.BeginForm())
{
    <form id="userAvatarForm" enctype="multipart/form-data">
        @Html.Hidden("ID", Model.ID)
        <table class="formtable">
            <tbody>
                <tr>
                    <th style="width:80px">
                        <label for="batchCode"><font color="red">*</font>自采煤批次</label>：
                    </th>
                    <td>
                        <input class="text-box single-line" data-val="true" data-val-required="字段是必需的。" id="batchCode" name="batchCode" readonly type="text" value="@Model.SELF_BATCH_CODE" autocomplete="off">
                    </td>
                    <th style="width:80px">
                    </th>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th style="width:80px">
                        <label for="batchCode"><font color="red">*</font>CRI</label>：
                    </th>
                    <td>
                        <input class="text-box single-line" data-val="true" data-val-required="字段是必需的。" id="batchCode" name="batchCode" readonly type="text" value="@Model.CRI" autocomplete="off">
                    </td>
                    <th style="width:80px">
                    </th>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th style="width:80px">
                        <label for="batchCode"><font color="red">*</font>CSR</label>：
                    </th>
                    <td>
                        <input class="text-box single-line" data-val="true" data-val-required="字段是必需的。" id="batchCode" name="batchCode" readonly type="text" value="@Model.CSR" autocomplete="off">
                    </td>
                    <th style="width:80px">
                    </th>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th style="width:80px">
                        <label for="testCode"><font color="red">*</font>入厂煤批次</label>：
                    </th>
                    <td>
                        <input class="text-box single-line" data-val="true" data-val-required="字段是必需的。" id="testCode" name="testCode" type="text" value="@Model.RC_BATCH_CODE" autocomplete="off">
                    </td>
                    <th style="width:80px">
                    </th>
                    <td>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    @Html.ValidationSummary()
}
<script type="text/javascript">
    var itemId = '';
    var checkboxs = new Array();
    $(function () {

    });
</script>
